// 封装订单页相关接口
import request from '@/utils/request.js'

// 用户提交订单
export const userSubmitOrderService = (data) => {
	return request({
		url: '/order/submit',
		method: 'POST',
		data
	})
}

// 用户确认付款
export const userPayOrderService = (data) => {
	return request({
		url: '/order/pay',
		method: 'POST',
		data
	})
}

// 获取用户的订单记录
export const userOrderRecordsService = (data) => {
	const {
		userID,
		orderStatus
	} = data
	return request({
		url: `/order/records/${userID}`,
		method: 'GET',
		params: {
			orderStatus
		}
	})
}

// 用户取消订单
export const userCancelOrderService = (data) => {
	return request({
		url: '/order/cancel',
		method: 'POST',
		data
	})
}

// 用户确认订单已出行
export const userConfirmOrderService = (orderID) => {
	return request({
		url: `/order/confirm/${orderID}`,
		method: 'POST'
	})
}

// 用户提交评价
export const userSubmitEvaluateService = (data) => {
	return request({
		url: '/evaluate/submit',
		method: 'POST',
		data
	})
}